#pragma once

#include "stdafx.h"
#include <d3d9.h>
#include <d3dx9.h>
#include "GameIO.h"
#include "GameObject.h"


// DEFINES
#define GAME_TITLE_SISE 128


class DemoApp
{
// FUNCTIONS
public:
	DemoApp(void);
	~DemoApp(void);
	DemoApp(HINSTANCE hInstance, char* gameName);
	
	virtual int updateGameState(long time);	// update the game state
	virtual int renderFrame(int time);		// redner the frame
	virtual int gameLoop(void);				// start the game loop
	virtual int initGame(void);				// initialize the game

private:
	int initWindow(void); // initialize the game window (assuming only one window)
	int initD3D(void);
	int init(void);


// MEMBERS
protected:
	HINSTANCE mhinstance; // application instance
	HWND mhwnd;			 //window handle

	long mFramesPerSecond;	// maximum numbef of frames per second
	int mFullScreen;  // determines whether the game is played in full screen
	
	int mWndWidth;   // window width and 
	int mWndHeight;  // window height

	char mGameName[GAME_TITLE_SISE+1];  // title of game (to be used in the window)

	// direct3D members
	IDirect3D9 *md3d;		// com object of directx 9;
	IDirect3DDevice9 *md3dDev;		//direct3D device;
	D3DPRESENT_PARAMETERS md3dpp;  // presentation parameters

	GameIO *mInput;
	int initGameInput(void);

public:
	int getWndWidth(void);
	int getWndHeight(void);
};
